//
//  MYY_User.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/10/26.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYY_User.h"
#import "NJXTLoginHelper.h"
#import "JKCoding.h"

#define USER_DATA_FILE [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"meiyinxiang_account.plist"]

#define JKClass MYY_User

@implementation MYY_User

JKCodingImplemention

- (void)save {
    [[NJXTLoginHelper helper] saveUser:self];
   // [NSKeyedArchiver archiveRootObject:self toFile:USER_DATA_FILE];
}


- (void)updateUser
{
    [[NJXTLoginHelper helper] updateUser:self];
}
- (void)deleteUserInfo{
    [[NJXTLoginHelper helper] clearCache:self];
}
+ (instancetype)getCurrentUser {
    MYY_User *user = [NSKeyedUnarchiver unarchiveObjectWithFile:USER_DATA_FILE];
    
    return user;
}

+ (MYY_User *)readUserFromFile
{
    return [[NJXTLoginHelper helper] readCurrentUser];
}
@end
